package com.jzy.stock.kufangguishu.controller;

import com.jzy.stock.kufangguishu.model.*;
import com.jzy.stock.kufangguishu.service.GuiShuService;
import com.jzy.stock.util.MateDateShengJiEnum;
import com.jzy.stock.util.ResultBuildVo;
import com.jzy.stock.util.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by PC on 2022/7/11.
 */
@RestController
@CrossOrigin
public class GuiShuController {
    @Autowired
    private GuiShuService guiShuService;
    @PostMapping("queryPage")
    public ResultVo queryPage(@RequestBody KuFangGuiShuSelectVo kuFangGuiShuSelectVo){
        return guiShuService.queryPage(kuFangGuiShuSelectVo);
    }

    @GetMapping("querylegalPerson")
    public ResultVo querylegalPerson(@RequestBody FaRenVo faRenVo){
        return guiShuService.querylegalPerson(faRenVo);
    }

    @PostMapping("queryStatus")
    public ResultVo queryStatus(){
        List<KuFangStatusVo> statusList = new ArrayList<>();
        for(MateDateShengJiEnum statusShengJiEnumEnum: MateDateShengJiEnum.values()){
            KuFangStatusVo status = new KuFangStatusVo(statusShengJiEnumEnum.getId(), statusShengJiEnumEnum.getName());
            statusList.add(status);
        }
        return ResultBuildVo.success(statusList);
    }
    @PostMapping("UpdateStatus")
    public ResultVo updateStatus(@RequestBody ReservoirAreaVo ReservoirAreaVo){
        return guiShuService.updateStatus(ReservoirAreaVo);
    }

    @PostMapping("see")
    public ResultVo see(@RequestBody StockroomVo stockroomVo){
        return guiShuService.see(stockroomVo);
    }

    @PostMapping("queryAll00")
    public ResultVo queryAll(){
        //先查全部库房、全部库区全部库位
        //再根据法人查库位、查库区、查库房
        List<queryAllVo>KuFangList = guiShuService.queryKuFang();

        return ResultBuildVo.success();
    }
}
